/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_LOCA_ATEN_MEDI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbLocaAtenMedi.findAll", query = "SELECT a FROM AmTbLocaAtenMedi a"),
    @NamedQuery(name = "AmTbLocaAtenMedi.findByCdLocaAtenMedi", query = "SELECT a FROM AmTbLocaAtenMedi a WHERE a.cdLocaAtenMedi = :cdLocaAtenMedi"),
    @NamedQuery(name = "AmTbLocaAtenMedi.findByNmLocaAten", query = "SELECT a FROM AmTbLocaAtenMedi a WHERE a.nmLocaAten = :nmLocaAten"),
    @NamedQuery(name = "AmTbLocaAtenMedi.findByNrEndeAtend", query = "SELECT a FROM AmTbLocaAtenMedi a WHERE a.nrEndeAtend = :nrEndeAtend"),
    @NamedQuery(name = "AmTbLocaAtenMedi.findByDsCompEnde", query = "SELECT a FROM AmTbLocaAtenMedi a WHERE a.dsCompEnde = :dsCompEnde")})
public class AmTbLocaAtenMedi implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "CD_LOCA_ATEN_MEDI")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "seq_AM_TB_LOCA_ATEN_MEDI")
    @SequenceGenerator(name="seq_AM_TB_LOCA_ATEN_MEDI", sequenceName = "seq_AM_TB_LOCA_ATEN_MEDI")
    private Integer cdLocaAtenMedi;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "NM_LOCA_ATEN")
    private String nmLocaAten;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NR_ENDE_ATEND")
    private int nrEndeAtend;
    @Size(max = 30)
    @Column(name = "DS_COMP_ENDE")
    private String dsCompEnde;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdLocaAtenMedi")
    private Collection<AmTbUsuaSistMedi> amTbUsuaSistMediCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdLocaAtenMedi")
    private Collection<AmTbAgenMedi> amTbAgenMediCollection;
    @JoinColumns({
        @JoinColumn(name = "CD_ESPE", referencedColumnName = "CD_ESPE"),
        @JoinColumn(name = "CD_MEDI", referencedColumnName = "CD_MEDI")})
    @ManyToOne(optional = false)
    private AmTbMediEspe amTbMediEspe;
    @JoinColumn(name = "CD_CEP", referencedColumnName = "CD_CEP")
    @ManyToOne(optional = false)
    private AmTbLogr cdCep;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "amTbLocaAtenMedi")
    private Collection<AmTbTeleLocaAten> amTbTeleLocaAtenCollection;

    public AmTbLocaAtenMedi() {
    }

    public AmTbLocaAtenMedi(Integer cdLocaAtenMedi) {
        this.cdLocaAtenMedi = cdLocaAtenMedi;
    }

    public AmTbLocaAtenMedi(Integer cdLocaAtenMedi, String nmLocaAten, int nrEndeAtend) {
        this.cdLocaAtenMedi = cdLocaAtenMedi;
        this.nmLocaAten = nmLocaAten;
        this.nrEndeAtend = nrEndeAtend;
    }

    public Integer getCdLocaAtenMedi() {
        return cdLocaAtenMedi;
    }

    public void setCdLocaAtenMedi(Integer cdLocaAtenMedi) {
        this.cdLocaAtenMedi = cdLocaAtenMedi;
    }

    public String getNmLocaAten() {
        return nmLocaAten;
    }

    public void setNmLocaAten(String nmLocaAten) {
        this.nmLocaAten = nmLocaAten;
    }

    public int getNrEndeAtend() {
        return nrEndeAtend;
    }

    public void setNrEndeAtend(int nrEndeAtend) {
        this.nrEndeAtend = nrEndeAtend;
    }

    public String getDsCompEnde() {
        return dsCompEnde;
    }

    public void setDsCompEnde(String dsCompEnde) {
        this.dsCompEnde = dsCompEnde;
    }

    @XmlTransient
    public Collection<AmTbUsuaSistMedi> getAmTbUsuaSistMediCollection() {
        return amTbUsuaSistMediCollection;
    }

    public void setAmTbUsuaSistMediCollection(Collection<AmTbUsuaSistMedi> amTbUsuaSistMediCollection) {
        this.amTbUsuaSistMediCollection = amTbUsuaSistMediCollection;
    }

    @XmlTransient
    public Collection<AmTbAgenMedi> getAmTbAgenMediCollection() {
        return amTbAgenMediCollection;
    }

    public void setAmTbAgenMediCollection(Collection<AmTbAgenMedi> amTbAgenMediCollection) {
        this.amTbAgenMediCollection = amTbAgenMediCollection;
    }

    public AmTbMediEspe getAmTbMediEspe() {
        return amTbMediEspe;
    }

    public void setAmTbMediEspe(AmTbMediEspe amTbMediEspe) {
        this.amTbMediEspe = amTbMediEspe;
    }

    public AmTbLogr getCdCep() {
        return cdCep;
    }

    public void setCdCep(AmTbLogr cdCep) {
        this.cdCep = cdCep;
    }

    @XmlTransient
    public Collection<AmTbTeleLocaAten> getAmTbTeleLocaAtenCollection() {
        return amTbTeleLocaAtenCollection;
    }

    public void setAmTbTeleLocaAtenCollection(Collection<AmTbTeleLocaAten> amTbTeleLocaAtenCollection) {
        this.amTbTeleLocaAtenCollection = amTbTeleLocaAtenCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdLocaAtenMedi != null ? cdLocaAtenMedi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbLocaAtenMedi)) {
            return false;
        }
        AmTbLocaAtenMedi other = (AmTbLocaAtenMedi) object;
        if ((this.cdLocaAtenMedi == null && other.cdLocaAtenMedi != null) || (this.cdLocaAtenMedi != null && !this.cdLocaAtenMedi.equals(other.cdLocaAtenMedi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbLocaAtenMedi[ cdLocaAtenMedi=" + cdLocaAtenMedi + " ]";
    }
    
}
